import React, { Component } from 'react'
import ReactDOM from 'react-dom';
import { Modal } from 'antd';
export default class Alert extends Component {
  state={
    visible:true,
    modalText:"123"
  }
  afterClose=()=>{
    let{handleCancel} = this.props
    handleCancel()
  }
  handleOk=()=>{
    let{handleOk} = this.props
    handleOk()
  }
  handleCancel=()=>{
   this.setState({
    visible:false
   })
  }
  render() {
    let{visible,modalText} = this.state
    let{title} = this.props
    return (
      <div>
         <Modal
        title={title}
        visible={visible}
        onCancel={this.handleCancel}
        afterClose={this.afterClose}
        onOk={this.handleOk}
      >
        {/*  onOk={handleOk}
        confirmLoading={confirmLoading}
        onCancel={handleCancel} */}
        <p>{modalText}</p>
      </Modal>
      </div>
    )
  }
}
Alert.newInstance = function newNotificationInstance(properties={}) {
  let props = properties || {};
  let div = document.createElement('div');
  document.body.appendChild(div);
  ReactDOM.render(React.createElement(Alert, props), div);
  return {
      destroy() {
          ReactDOM.unmountComponentAtNode(div);
          document.body.removeChild(div);
      },
  };
};